package com.bigcat.gulimall.demo.java8.interfaceDefaultAndStatic;

import java.util.function.Supplier;

/**
 * @author sufer_yuan
 * @since 2022/2/7
 */
public class DefaulableFactory {
    // Interfaces now allow static methods
    static Defaulable create( Supplier< Defaulable > supplier ) {
        return supplier.get();
    }

    public static void main( String[] args ) {
        Defaulable defaulable = DefaulableFactory.create(DefaultableImpl::new);
        System.out.println( defaulable.notRequired() );

        defaulable = DefaulableFactory.create( OverridableImpl::new );
        System.out.println( defaulable.notRequired() );
    }

}
